
CPPFLAGS=-g -Wall -Wno-deprecated -IAst
libs=Ast/Ast.a 
ldflags=$(shell llvm-config --ldflags --libs) 


src_files= main.cc Assembler.cc ClassFile.cc ClassFileConstant.cc SimpleIo.cc ConstantPool.cc \
	FieldInfo.cc MethodInfo.cc AttributeInfo.cc grammar.cc scanner.cc SymbolPool.cc \
	CompileGraphVis.cc CompileJvm.cc CompileLlvm.cc 

obj_files=$(src_files:.cc=.o)

all: Ast sabc dumpKlass

sabc: $(obj_files) $(libs)
	g++ -o sabc $(obj_files) $(ldflags) $(libs)

Ast: 
	cd Ast && make

dumpKlass: dumpKlass.o Assembler.o ClassFile.o ClassFileConstant.o SimpleIo.o ConstantPool.o FieldInfo.o MethodInfo.o AttributeInfo.o
	g++ -o dumpKlass dumpKlass.o Assembler.o ClassFile.o ClassFileConstant.o SimpleIo.o ConstantPool.o FieldInfo.o MethodInfo.o AttributeInfo.o $(ldflags)

grammar.cc: grammar.y
	bison -o grammar.cc grammar.y -d -r all

scanner.cc: scanner.l
	flex -o scanner.cc scanner.l 

#test-all: main
#	./test-all.sh

docs:
	doxygen Doxyfile

depend:
	makedepend *.cc grammar.y scanner.l 

clean:
	rm -f *.o
	rm -f sabc
	rm -f dumpKlass
	rm -f grammar.cc scanner.cc grammar.hh
	rm -f test-all.result
	rm -f grammar.output
	cd Ast && make clean

.PHONY: depend clean Ast
# DO NOT DELETE

Assembler.o: /usr/include/strings.h /usr/include/features.h
Assembler.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
Assembler.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
Assembler.o: /usr/include/xlocale.h /usr/include/stdio.h
Assembler.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
Assembler.o: /usr/include/libio.h /usr/include/_G_config.h
Assembler.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
Assembler.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
Assembler.o: /usr/include/sys/types.h /usr/include/time.h
Assembler.o: /usr/include/endian.h /usr/include/bits/endian.h
Assembler.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
Assembler.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
Assembler.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
Assembler.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
Assembler.o: /usr/include/assert.h Assembler.h jtypes.h SimpleIo.h
Assembler.o: ConstantPool.h ClassFileConstant.h
AttributeInfo.o: /usr/include/assert.h /usr/include/features.h
AttributeInfo.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
AttributeInfo.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
AttributeInfo.o: /usr/include/string.h /usr/include/xlocale.h jtypes.h
AttributeInfo.o: /usr/include/stdio.h /usr/include/bits/types.h
AttributeInfo.o: /usr/include/bits/typesizes.h /usr/include/libio.h
AttributeInfo.o: /usr/include/_G_config.h /usr/include/wchar.h
AttributeInfo.o: /usr/include/bits/stdio_lim.h
AttributeInfo.o: /usr/include/bits/sys_errlist.h AttributeInfo.h SimpleIo.h
AttributeInfo.o: Assembler.h ConstantPool.h ClassFileConstant.h Log.h
ClassFile.o: /usr/include/assert.h /usr/include/features.h
ClassFile.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
ClassFile.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
ClassFile.o: /usr/include/stdio.h /usr/include/bits/types.h
ClassFile.o: /usr/include/bits/typesizes.h /usr/include/libio.h
ClassFile.o: /usr/include/_G_config.h /usr/include/wchar.h
ClassFile.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
ClassFile.o: /usr/include/stdlib.h /usr/include/sys/types.h
ClassFile.o: /usr/include/time.h /usr/include/endian.h
ClassFile.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h
ClassFile.o: /usr/include/sys/select.h /usr/include/bits/select.h
ClassFile.o: /usr/include/bits/sigset.h /usr/include/bits/time.h
ClassFile.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h
ClassFile.o: /usr/include/alloca.h /usr/include/string.h
ClassFile.o: /usr/include/xlocale.h ClassFile.h ConstantPool.h jtypes.h
ClassFile.o: ClassFileConstant.h SimpleIo.h FieldInfo.h MethodInfo.h
ClassFile.o: AttributeInfo.h Assembler.h Log.h
ClassFileConstant.o: /usr/include/string.h /usr/include/features.h
ClassFileConstant.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
ClassFileConstant.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
ClassFileConstant.o: /usr/include/xlocale.h /usr/include/assert.h
ClassFileConstant.o: ClassFileConstant.h jtypes.h /usr/include/stdio.h
ClassFileConstant.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
ClassFileConstant.o: /usr/include/libio.h /usr/include/_G_config.h
ClassFileConstant.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
ClassFileConstant.o: /usr/include/bits/sys_errlist.h SimpleIo.h
ClassFileConstant.o: ConstantPool.h
CompileGraphVis.o: /usr/include/stdio.h /usr/include/features.h
CompileGraphVis.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
CompileGraphVis.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
CompileGraphVis.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
CompileGraphVis.o: /usr/include/libio.h /usr/include/_G_config.h
CompileGraphVis.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
CompileGraphVis.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h
CompileGraphVis.o: /usr/include/sys/types.h /usr/include/time.h
CompileGraphVis.o: /usr/include/endian.h /usr/include/bits/endian.h
CompileGraphVis.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
CompileGraphVis.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
CompileGraphVis.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
CompileGraphVis.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
CompileGraphVis.o: /usr/include/string.h /usr/include/xlocale.h
CompileGraphVis.o: /usr/include/ctype.h /usr/include/assert.h
CompileGraphVis.o: CompileGraphVis.h jtypes.h CompileVisitor.h
CompileJvm.o: /usr/include/assert.h /usr/include/features.h
CompileJvm.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
CompileJvm.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
CompileJvm.o: CompileJvm.h CompileVisitor.h jtypes.h /usr/include/stdio.h
CompileJvm.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
CompileJvm.o: /usr/include/libio.h /usr/include/_G_config.h
CompileJvm.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
CompileJvm.o: /usr/include/bits/sys_errlist.h MethodInfo.h AttributeInfo.h
CompileJvm.o: SimpleIo.h Assembler.h RelocTable.h ClassFile.h ConstantPool.h
CompileJvm.o: ClassFileConstant.h
CompileLlvm.o: CompileLlvm.h
ConstantPool.o: /usr/include/assert.h /usr/include/features.h
ConstantPool.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
ConstantPool.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
ConstantPool.o: /usr/include/string.h /usr/include/xlocale.h
ConstantPool.o: ClassFileConstant.h jtypes.h /usr/include/stdio.h
ConstantPool.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
ConstantPool.o: /usr/include/libio.h /usr/include/_G_config.h
ConstantPool.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
ConstantPool.o: /usr/include/bits/sys_errlist.h ConstantPool.h SimpleIo.h
ConstantPool.o: Log.h
dumpKlass.o: /usr/include/stdio.h /usr/include/features.h
dumpKlass.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
dumpKlass.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
dumpKlass.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
dumpKlass.o: /usr/include/libio.h /usr/include/_G_config.h
dumpKlass.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
dumpKlass.o: /usr/include/bits/sys_errlist.h ClassFile.h ConstantPool.h
dumpKlass.o: jtypes.h ClassFileConstant.h MethodInfo.h AttributeInfo.h
dumpKlass.o: SimpleIo.h Assembler.h
FieldInfo.o: /usr/include/assert.h /usr/include/features.h
FieldInfo.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
FieldInfo.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h SimpleIo.h
FieldInfo.o: /usr/include/stdio.h /usr/include/bits/types.h
FieldInfo.o: /usr/include/bits/typesizes.h /usr/include/libio.h
FieldInfo.o: /usr/include/_G_config.h /usr/include/wchar.h
FieldInfo.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
FieldInfo.o: FieldInfo.h jtypes.h ConstantPool.h ClassFileConstant.h
FieldInfo.o: AttributeInfo.h Assembler.h Log.h
main.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
main.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h
main.o: /usr/include/gnu/stubs-32.h /usr/include/bits/types.h
main.o: /usr/include/bits/typesizes.h /usr/include/libio.h
main.o: /usr/include/_G_config.h /usr/include/wchar.h
main.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
main.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
main.o: /usr/include/endian.h /usr/include/bits/endian.h
main.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
main.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
main.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
main.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
main.o: /usr/include/getopt.h /usr/include/string.h /usr/include/xlocale.h
main.o: ClassFile.h ConstantPool.h jtypes.h ClassFileConstant.h MethodInfo.h
main.o: AttributeInfo.h SimpleIo.h Assembler.h CompileLlvm.h
main.o: CompileGraphVis.h CompileVisitor.h CompileJvm.h RelocTable.h
MethodInfo.o: /usr/include/assert.h /usr/include/features.h
MethodInfo.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
MethodInfo.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h SimpleIo.h
MethodInfo.o: /usr/include/stdio.h /usr/include/bits/types.h
MethodInfo.o: /usr/include/bits/typesizes.h /usr/include/libio.h
MethodInfo.o: /usr/include/_G_config.h /usr/include/wchar.h
MethodInfo.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
MethodInfo.o: MethodInfo.h AttributeInfo.h jtypes.h Assembler.h
MethodInfo.o: ConstantPool.h ClassFileConstant.h Log.h
SimpleIo.o: SimpleIo.h /usr/include/stdio.h /usr/include/features.h
SimpleIo.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
SimpleIo.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
SimpleIo.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
SimpleIo.o: /usr/include/libio.h /usr/include/_G_config.h
SimpleIo.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
SimpleIo.o: /usr/include/bits/sys_errlist.h
SymbolPool.o: /usr/include/stdlib.h /usr/include/features.h
SymbolPool.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
SymbolPool.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
SymbolPool.o: /usr/include/sys/types.h /usr/include/bits/types.h
SymbolPool.o: /usr/include/bits/typesizes.h /usr/include/time.h
SymbolPool.o: /usr/include/endian.h /usr/include/bits/endian.h
SymbolPool.o: /usr/include/bits/byteswap.h /usr/include/sys/select.h
SymbolPool.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
SymbolPool.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h
SymbolPool.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h
SymbolPool.o: /usr/include/string.h /usr/include/xlocale.h SymbolPool.h
SymbolPool.o: /usr/include/assert.h jtypes.h /usr/include/stdio.h
SymbolPool.o: /usr/include/libio.h /usr/include/_G_config.h
SymbolPool.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h
SymbolPool.o: /usr/include/bits/sys_errlist.h
grammar.o: /usr/include/math.h /usr/include/features.h
grammar.o: /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h
grammar.o: /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h
grammar.o: /usr/include/bits/huge_val.h /usr/include/bits/huge_valf.h
grammar.o: /usr/include/bits/huge_vall.h /usr/include/bits/inf.h
grammar.o: /usr/include/bits/nan.h /usr/include/bits/mathdef.h
grammar.o: /usr/include/bits/mathcalls.h /usr/include/stdio.h
grammar.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h
grammar.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h
grammar.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
grammar.o: ConstantPool.h jtypes.h ClassFileConstant.h ClassFile.h
grammar.o: SymbolPool.h /usr/include/assert.h
